# added by yinchao, Tue June 25 11:05	2024
# 解析 html document

import urllib.request
import re
import ssl

# Ignore ssl certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

url = input('Enter a url address, default(https://docs.python.org): ')
if url == '':
    url = 'https://docs.python.org'
html = urllib.request.urlopen(url=url, context=ctx).read()
links = re.findall(b'href="(http[s]?://.*?)"', html)

for link in links:
    print(link.decode())
